Skip to content

Commit 8974faf

Browse files
authored
Merge pull request #242 from bastelfreak/tests2
openssl::certificate::pkcs12: Add test for x509 without password
2 parents cf0250c + b36ef28 commit 8974faf

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

examples/export_pkcs12_from_key.pp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,22 @@
1818
in_pass => 'mahje1Qu',
1919
out_pass => 'mahje1Qu',
2020
}
21+
22+
# same as above, just no password for the X509
23+
openssl::certificate::x509 { 'foo2.example.com':
24+
ensure => present,
25+
country => 'CH',
26+
organization => 'Example.com',
27+
commonname => 'foo2.example.com',
28+
base_dir => '/tmp',
29+
owner => 'nobody',
30+
# This is just to speed up CI - use 2048 or more in production
31+
key_size => 1024,
32+
}
33+
-> openssl::export::pkcs12 { 'export2.pkcs12':
34+
ensure => 'present',
35+
basedir => '/tmp',
36+
pkey => '/tmp/foo2.example.com.key',
37+
cert => '/tmp/foo2.example.com.crt',
38+
out_pass => 'mahje1Qu',
39+
}

spec/acceptance/pkcs12_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,17 @@
77
it { expect(file('/tmp/foo.example.com.crt')).to be_file.and(have_attributes(owner: 'nobody', group: 'root')) }
88
it { expect(file('/tmp/foo.example.com.key')).to be_file.and(have_attributes(owner: 'nobody', group: 'root')) }
99
it { expect(file('/tmp/export.pkcs12.p12')).to be_file.and(have_attributes(owner: 'root', group: 'root')) }
10+
it { expect(file('/tmp/foo2.example.com.crt')).to be_file.and(have_attributes(owner: 'nobody', group: 'root')) }
11+
it { expect(file('/tmp/foo2.example.com.key')).to be_file.and(have_attributes(owner: 'nobody', group: 'root')) }
12+
it { expect(file('/tmp/export2.pkcs12.p12')).to be_file.and(have_attributes(owner: 'root', group: 'root')) }
1013
end
14+
# rubocop:disable RSpec/RepeatedExampleGroupBody
1115
describe file('/tmp/export.pkcs12.p12') do
1216
its(:size) { is_expected.to be > 0 }
1317
end
18+
19+
describe file('/tmp/export2.pkcs12.p12') do
20+
its(:size) { is_expected.to be > 0 }
21+
end
22+
# rubocop:enable RSpec/RepeatedExampleGroupBody
1423
end

0 commit comments

Comments
 (0)