Skip to content

Commit

Permalink
Drop apache username/password (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
ekohl authored Sep 14, 2017
1 parent fe97376 commit b98f9ed
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 7 deletions.
9 changes: 2 additions & 7 deletions manifests/apache.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
$expiration = $::certs::expiration,
$default_ca = $::certs::default_ca,
$ca_key_password_file = $::certs::ca_key_password_file,
$group = $::certs::group,
) inherits certs {

$apache_cert_name = "${hostname}-apache"
Expand Down Expand Up @@ -56,18 +55,14 @@
}

if $deploy {

include ::apache

certs::keypair { 'apache':
key_pair => $apache_cert_name,
key_file => $apache_key,
manage_key => true,
key_owner => $::apache::user,
key_owner => 'root',
key_group => 'root',
key_mode => '0440',
key_group => $group,
cert_file => $apache_cert,
notify => Service['httpd'],
}
}
}
39 changes: 39 additions & 0 deletions spec/acceptance/apache_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
require 'spec_helper_acceptance'

describe 'certs::apache' do
before(:all) do
install_repo = <<-EOS
yumrepo { 'katello':
descr => 'Katello latest',
baseurl => 'https://fedorapeople.org/groups/katello/releases/yum/latest/katello/el7/$basearch/',
gpgcheck => false,
enabled => true,
}
EOS

apply_manifest(install_repo)
end

context 'with default parameters' do
let(:pp) do
'include ::certs::apache'
end

it_behaves_like 'a idempotent resource'

describe x509_certificate('/etc/pki/katello/certs/katello-apache.crt') do
it { should be_certificate }
it { should be_valid }
it { should have_purpose 'server' }
its(:issuer) { should eq "/C=US/ST=North Carolina/L=Raleigh/O=Katello/OU=SomeOrgUnit/CN=#{fact('fqdn')}" }
its(:subject) { should eq "/C=US/ST=North Carolina/O=Katello/OU=SomeOrgUnit/CN=#{fact('fqdn')}" }
its(:keylength) { should be >= 2048 }
end

describe x509_private_key('/etc/pki/katello/private/katello-apache.key') do
it { should_not be_encrypted }
it { should be_valid }
it { should have_matching_certificate('/etc/pki/katello/certs/katello-apache.crt') }
end
end
end

0 comments on commit b98f9ed

Please sign in to comment.