Skip to content

Commit

Permalink
Merge pull request #137 from luxflux/server-as-client-fix
Browse files Browse the repository at this point in the history
fix server as client mode
  • Loading branch information
luxflux committed Mar 3, 2015
2 parents 9ced2be + b36d4de commit 3b12957
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
3 changes: 3 additions & 0 deletions manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,9 @@
} else {
# VPN Client Mode

$ca_name = $name
$ca_common_name = $name

file { "/etc/openvpn/${name}/keys":
ensure => directory,
mode => '0750',
Expand Down
28 changes: 18 additions & 10 deletions spec/defines/openvpn_server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@
end

context "creating a server in client mode" do
let(:title) { 'test_client' }
let(:params) { {
'remote' => ['vpn.example.com 12345'],
'server_poll_timeout' => 1,
Expand All @@ -238,18 +239,25 @@
:lsbdistrelease => '12.04',
} }

it { should contain_file('/etc/openvpn/test_server.conf').with_content(/^client$/) }
it { should contain_file('/etc/openvpn/test_server.conf').with_content(/^remote\s+vpn.example.com\s+12345$/) }
it { should contain_file('/etc/openvpn/test_server.conf').with_content(/^server-poll-timeout\s+1$/) }
it { should contain_file('/etc/openvpn/test_server.conf').with_content(/^ping-timer-rem$/) }
it { should contain_file('/etc/openvpn/test_server/keys').
it { should contain_file('/etc/openvpn/test_client.conf').with_content(/^client$/) }
it { should contain_file('/etc/openvpn/test_client.conf').
with_content(/^remote\s+vpn.example.com\s+12345$/) }
it { should contain_file('/etc/openvpn/test_client.conf').with_content(/^server-poll-timeout\s+1$/) }
it { should contain_file('/etc/openvpn/test_client.conf').with_content(/^ping-timer-rem$/) }
it { should contain_file('/etc/openvpn/test_client.conf').
with_content(%r{^ca /etc/openvpn/test_client/keys/ca.crt$}) }
it { should contain_file('/etc/openvpn/test_client.conf').
with_content(%r{^cert /etc/openvpn/test_client/keys/test_client.crt$}) }
it { should contain_file('/etc/openvpn/test_client.conf').
with_content(%r{^key /etc/openvpn/test_client/keys/test_client.key$}) }
it { should contain_file('/etc/openvpn/test_client/keys').
with(:ensure =>'directory', :mode =>'0750', :group =>'nogroup') }
it { should contain_file('/etc/openvpn/test_server.conf').with_content(/^ns-cert-type server/) }
it { should_not contain_file('/etc/openvpn/test_server.conf').with_content(/^mode\s+server$/) }
it { should_not contain_file('/etc/openvpn/test_server.conf').with_content(/^client-config-dir/) }
it { should_not contain_file('/etc/openvpn/test_server.conf').with_content(/^dh/) }
it { should contain_file('/etc/openvpn/test_client.conf').with_content(/^ns-cert-type server/) }
it { should_not contain_file('/etc/openvpn/test_client.conf').with_content(/^mode\s+server$/) }
it { should_not contain_file('/etc/openvpn/test_client.conf').with_content(/^client-config-dir/) }
it { should_not contain_file('/etc/openvpn/test_client.conf').with_content(/^dh/) }

it { should_not contain_openvpn__ca('test_server') }
it { should_not contain_openvpn__ca('test_client') }
end

context "when altering send and receive buffers" do
Expand Down

0 comments on commit 3b12957

Please sign in to comment.