Skip to content

Commit

Permalink
Merge pull request #94 from Liukke/BUG_fix_symlink_is_directory
Browse files Browse the repository at this point in the history
[liukke, asedge] - Fixed openssl.cnf becomes a directory instead of syml...
  • Loading branch information
luxflux committed Sep 22, 2014
2 parents a71b0b2 + 7e61e59 commit e4c4558
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
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

0 comments on commit e4c4558

Please sign in to comment.