serverspec 2.35.0 → 2.36.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 609cc80dcfdad218ce5f7d2956aa32ba29c8980a
4
- data.tar.gz: 05f826f398abb44f97607c418f793073278fcbe6
3
+ metadata.gz: e3689402c5d03f438cdb273aa1300f49604319e6
4
+ data.tar.gz: 8cc6ee4a4bb5fda653cfeccfed3e53c4f5459470
5
5
  SHA512:
6
- metadata.gz: 1e934fe845e12bfa2595bc9cb0fbc398c4447048db1d0191c5faec12c09db5d8b4f1a5a1763047e6fda40891bd9d4596ba1534ff89373a6de882a0ae9d94570b
7
- data.tar.gz: 2223c7bc8076116961b5ac8a143d2affe31db54818a2397ae7b181a96a91ae3eba8a51befef7ba424d6c0ff2220d563ce2ea6ce0cb32991f30b70fbd72550561
6
+ metadata.gz: 63b56de0b976a48f57563fca617bc74e5ec0176458ee36cb4c7d02f26f0382b404965e0bfcd8935e3efc26907b89a0ef65782971599f6530e30e4d270b21a006
7
+ data.tar.gz: b7aaafc17b9ea01c96907cc0cc3a0e0015bdf096822e8ddf170d8af7b94e828546445a3d6e60f5568efeb2a9f013742b2fdaad4bd5bfea1ccfc65a29efd5965f
@@ -298,7 +298,7 @@ set :ssh_options, options
298
298
 
299
299
 
300
300
  # Set environment variables
301
- # set :env, :LANG => 'C', :LC_MESSAGES => 'C'
301
+ # set :env, :LANG => 'C', :LC_MESSAGES => 'C'
302
302
 
303
303
  # Set PATH
304
304
  # set :path, '/sbin:/usr/local/sbin:$PATH'
@@ -60,6 +60,15 @@ module Serverspec::Type
60
60
  ( diff/(60*60*24) )
61
61
  end
62
62
 
63
+ def subject_alt_names
64
+ text = run_openssl_command_with('-text -noout').stdout
65
+ # X509v3 Subject Alternative Name:
66
+ # DNS:*.example.com, DNS:www.example.net, IP:192.0.2.10
67
+ if text =~ /^ *X509v3 Subject Alternative Name: *\n *(.*)$/
68
+ $1.split(/, +/)
69
+ end
70
+ end
71
+
63
72
  private
64
73
  def run_openssl_command_with(param_str)
65
74
  @runner.run_command("openssl x509 -in #{name} #{param_str}")
@@ -1,3 +1,3 @@
1
1
  module Serverspec
2
- VERSION = "2.35.0"
2
+ VERSION = "2.36.0"
3
3
  end
@@ -33,6 +33,10 @@ describe x509_certificate('test.pem') do
33
33
  it { should_not be_valid }
34
34
  end
35
35
 
36
+ describe x509_certificate('test.pem') do
37
+ let(:stdout) { sample_san }
38
+ its(:subject_alt_names) { should eq %w[DNS:*.example.com DNS:www.example.net IP:192.0.2.10] }
39
+ end
36
40
 
37
41
  def sample_subj
38
42
  <<'EOS'
@@ -60,3 +64,15 @@ notAfter=Jul 1 11:11:00 2010 GMT
60
64
  EOS
61
65
  end
62
66
 
67
+ def sample_san
68
+ <<'EOS'
69
+ Certificate:
70
+ Data:
71
+ Version: 3 (0x2)
72
+ X509v3 extensions:
73
+ X509v3 Extended Key Usage:
74
+ TLS Web Server Authentication, TLS Web Client Authentication
75
+ X509v3 Subject Alternative Name:
76
+ DNS:*.example.com, DNS:www.example.net, IP:192.0.2.10
77
+ EOS
78
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serverspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.35.0
4
+ version: 2.36.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gosuke Miyashita
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-15 00:00:00.000000000 Z
11
+ date: 2016-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec