Sha256: 63b9beeff763b3c58a2c76bede76648a5fbc248427dee07a134a5002818fbcde

Contents?: true

Size: 1.59 KB

Versions: 18

Compression:

Stored size: 1.59 KB

Contents

require 'spec_helper'

set :os, :family => 'linux'

describe x509_certificate('test.pem') do
  let(:exit_status) { 0 }
  it { should be_certificate }
end

describe x509_certificate('test.pem') do
  let(:exit_status) { 1 }
  it { should_not be_certificate }
end

describe x509_certificate('test.pem') do
  let(:stdout) { sample_subj }
  its(:subject) { should eq '/O=some/OU=thing' }
end

describe x509_certificate('test.pem') do
  let(:stdout) { sample_issuer }
  its(:issuer) { should eq '/O=some/OU=issuer' }
end

describe x509_certificate('test.pem') do
  let(:stdout) { sample_validity }
  it { should be_valid }
  its(:validity_in_days) { should be >= 1000 }
end

describe x509_certificate('test.pem') do
  let(:stdout) { sample_validity2 }
  it { should_not be_valid }
end

describe x509_certificate('test.pem') do
  let(:stdout) { sample_san }
  its(:subject_alt_names) { should eq %w[DNS:*.example.com DNS:www.example.net IP:192.0.2.10] }
end

def sample_subj
  <<'EOS'
subject= /O=some/OU=thing
EOS
end

def sample_issuer
  <<'EOS'
issuer= /O=some/OU=issuer
EOS
end

def sample_validity
  <<'EOS'
notBefore=Jul  1 11:11:00 2000 GMT
notAfter=Jul  1 11:11:00 2050 GMT
EOS
end

def sample_validity2
  <<'EOS'
notBefore=Jul  1 11:11:00 2000 GMT
notAfter=Jul  1 11:11:00 2010 GMT
EOS
end

def sample_san
  <<'EOS'
Certificate:
    Data:
        Version: 3 (0x2)
        X509v3 extensions:
            X509v3 Extended Key Usage:
                TLS Web Server Authentication, TLS Web Client Authentication
            X509v3 Subject Alternative Name:
                DNS:*.example.com, DNS:www.example.net, IP:192.0.2.10
EOS
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
serverspec-2.41.6 spec/type/linux/x509_certificate_spec.rb
serverspec-2.41.5 spec/type/linux/x509_certificate_spec.rb
serverspec-2.41.4 spec/type/linux/x509_certificate_spec.rb
serverspec-2.41.3 spec/type/linux/x509_certificate_spec.rb
serverspec-2.41.2 spec/type/linux/x509_certificate_spec.rb
serverspec-2.41.1 spec/type/linux/x509_certificate_spec.rb
serverspec-2.41.0 spec/type/linux/x509_certificate_spec.rb
serverspec-2.40.0 spec/type/linux/x509_certificate_spec.rb
serverspec-2.39.2 spec/type/linux/x509_certificate_spec.rb
serverspec-2.39.1 spec/type/linux/x509_certificate_spec.rb
serverspec-2.39.0 spec/type/linux/x509_certificate_spec.rb
serverspec-2.38.1 spec/type/linux/x509_certificate_spec.rb
serverspec-2.38.0 spec/type/linux/x509_certificate_spec.rb
serverspec-2.37.2 spec/type/linux/x509_certificate_spec.rb
serverspec-2.37.1 spec/type/linux/x509_certificate_spec.rb
serverspec-2.37.0 spec/type/linux/x509_certificate_spec.rb
serverspec-2.36.1 spec/type/linux/x509_certificate_spec.rb
serverspec-2.36.0 spec/type/linux/x509_certificate_spec.rb