diff --git a/manifests/client.pp b/manifests/client.pp index ee8b5fd9..5943ef3f 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -124,6 +124,9 @@ # String, The name of an openssl::ca resource to use. # Default: undef # +# [*custom_options*] +# Hash of additional options that you want to append to the configuration file. +# # === Examples # # openvpn::client { @@ -185,6 +188,7 @@ $sndbuf = undef, $rcvbuf = undef, $shared_ca = undef, + $custom_options = {}, ) { if $pam { diff --git a/spec/defines/openvpn_client_spec.rb b/spec/defines/openvpn_client_spec.rb index bef88a30..b7e3770b 100644 --- a/spec/defines/openvpn_client_spec.rb +++ b/spec/defines/openvpn_client_spec.rb @@ -160,8 +160,19 @@ context "when using not existed shared ca" do let(:params) { { 'server' => 'test_server', - 'shared_ca' => 'my_already_existing_ca', + 'shared_ca' => 'my_already_existing_ca', } } it { expect { should compile }.to raise_error } end + + context 'custom options' do + let(:params) do + { + 'server' => 'test_server', + 'custom_options' => { 'this' => 'that' } + } + end + + it { should contain_file('/etc/openvpn/test_server/download-configs/test_client/test_client.conf').with_content(%r{^this that$}) } + end end diff --git a/templates/client.erb b/templates/client.erb index cd5702be..ee5aa882 100644 --- a/templates/client.erb +++ b/templates/client.erb @@ -63,3 +63,8 @@ tls-auth keys/<%= @name %>/ta.key 1 # x509 name verification verify-x509-name "<%= @x509_name %>" name <% end -%> + +# Additional custom options +<% @custom_options.each_pair do |key, value| -%> +<%= key %> <%= value %> +<% end -%>