Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[liukke, asedge] - Fixed openssl.cnf becomes a directory instead of syml... #94

Merged
merged 2 commits into from
Sep 22, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -367,16 +367,16 @@

File {
group => $group_to_set,
recurse => true,
}

file {
[ "/etc/openvpn/${name}",
"/etc/openvpn/${name}/auth",
"/etc/openvpn/${name}/client-configs",
"/etc/openvpn/${name}/download-configs" ]:
ensure => directory,
mode => '0750',
ensure => directory,
mode => '0750',
recurse => true,
}

exec { "copy easy-rsa to openvpn config folder ${name}":
Expand All @@ -394,6 +394,7 @@
file { "/etc/openvpn/${name}/easy-rsa/revoked":
ensure => directory,
mode => '0750',
recurse => true,
require => Exec["copy easy-rsa to openvpn config folder ${name}"],
}

Expand Down Expand Up @@ -447,6 +448,12 @@
require => Exec["copy easy-rsa to openvpn config folder ${name}"],
}

file { "/etc/openvpn/${name}/crl.pem":
mode => '0750',
group => $group_to_set,
require => [Exec["create crl.pem on ${name}"], File["/etc/openvpn/${name}"]],
}

exec { "create crl.pem on ${name}":
command => ". ./vars && KEY_CN='' KEY_OU='' KEY_NAME='' KEY_ALTNAMES='' openssl ca -gencrl -out /etc/openvpn/${name}/crl.pem -config /etc/openvpn/${name}/easy-rsa/openssl.cnf",
cwd => "/etc/openvpn/${name}/easy-rsa",
Expand Down
21 changes: 18 additions & 3 deletions spec/defines/openvpn_server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
it { should contain_file('/etc/openvpn/test_server/easy-rsa/revoked').
with(:ensure =>'directory', :mode =>'0750', :recurse =>true, :group =>'nogroup') }
it { should contain_file('/etc/openvpn/test_server/easy-rsa/vars')}
it { should contain_file('/etc/openvpn/test_server/easy-rsa/openssl.cnf') }
it { should contain_file('/etc/openvpn/test_server/easy-rsa/openssl.cnf').
with(:recurse =>nil, :group =>'nogroup') }
it { should contain_file('/etc/openvpn/test_server/easy-rsa/keys/crl.pem').
with(:ensure =>'link', :target =>'/etc/openvpn/test_server/crl.pem') }
it { should contain_file('/etc/openvpn/test_server/keys').
Expand Down Expand Up @@ -221,11 +222,18 @@

it { should contain_file('/etc/openvpn/test_server/easy-rsa/openssl.cnf').with(
'ensure' => 'link',
'target' => '/etc/openvpn/test_server/easy-rsa/openssl-1.0.0.cnf'
'target' => '/etc/openvpn/test_server/easy-rsa/openssl-1.0.0.cnf',
'recurse' => nil,
'group' => 'nobody'
)}

it { should contain_file('/etc/openvpn/test_server.conf').with_content(/^group\s+nobody$/) }

it { should contain_file('/etc/openvpn/test_server/crl.pem').with(
'mode' => '0750',
'group' => 'nobody'
)}

end

context "when Debian based machine" do
Expand Down Expand Up @@ -272,7 +280,9 @@

it { should contain_file('/etc/openvpn/test_server/easy-rsa/openssl.cnf').with(
'ensure' => 'link',
'target' => '/etc/openvpn/test_server/easy-rsa/openssl-1.0.0.cnf'
'target' => '/etc/openvpn/test_server/easy-rsa/openssl-1.0.0.cnf',
'recurse' => nil,
'group' => 'nogroup'
)}

it { should contain_exec('copy easy-rsa to openvpn config folder test_server').with(
Expand All @@ -287,6 +297,11 @@

it { should contain_file('/etc/openvpn/test_server.conf').with_content(/^group\s+nogroup$/) }

it { should contain_file('/etc/openvpn/test_server/crl.pem').with(
'mode' => '0750',
'group' => 'nogroup'
)}

end

context 'ldap' do
Expand Down