diff --git a/test/integration/default/controls/cert.rb b/test/integration/default/controls/cert.rb index e517d14..711cdfa 100644 --- a/test/integration/default/controls/cert.rb +++ b/test/integration/default/controls/cert.rb @@ -3,12 +3,24 @@ control "Cert x509 #{os.name}" do title 'Test x509 cert files' - dir = '/home/vagrant/crt/acmeshtest.gn98.de' + crts = { + 'standalone.gn98.de' => { + 'alias' => 'www.standalone.gn98.de', + 'keylength' => 2048, + }, + 'alpn.gn98.de' => { + 'keylength' => 4096, + } + } + crts.each do |cn, conf| + dir = "/home/vagrant/crt/#{cn}" - describe x509_certificate("#{dir}/fullchain.cer") do - it { should be_certificate } - its('key_length') { should be 4096 } - its('subject.CN') { should eq 'acmeshtest.gn98.de' } - its('validity_in_days') { should be > 30 } + describe x509_certificate("#{dir}/fullchain.cer") do + it { should be_certificate } + its('subject.CN') { should eq cn } + its('keylength') { should eq conf['keylength'] } + its('subject_alt_names') { should include "DNS:#{conf['alias']}" } if conf['alias'] + its('validity_in_days') { should be > 30 } + end end end diff --git a/test/integration/default/controls/file.rb b/test/integration/default/controls/file.rb index 79b7fb1..6473a62 100644 --- a/test/integration/default/controls/file.rb +++ b/test/integration/default/controls/file.rb @@ -1,19 +1,23 @@ # frozen_string_literal: true -control "Cert files #{os.name}" do +control "Cert files #{os.name} #{os.release}" do title 'Test cert files' - dir = '/home/vagrant/crt/acmeshtest.gn98.de' + crts = ['standalone.gn98.de', 'alpn.gn98.de'] + + crts.each do |crt| + dir = "/home/vagrant/crt/#{crt}" - describe directory(dir) do - it { should exist } - end + describe directory(dir) do + it { should exist } + end - describe file("#{dir}/fullchain.cer") do - it { should exist } - end + describe file("#{dir}/fullchain.cer") do + it { should exist } + end - describe file("#{dir}/acmeshtest.gn98.de.key") do - it { should exist } + describe file("#{dir}/#{crt}.key") do + it { should exist } + end end end