diff options
author | Justin Lambert <jlambert@eml.cc> | 2013-01-14 09:30:24 -0700 |
---|---|---|
committer | Justin Lambert <jlambert@eml.cc> | 2013-01-14 09:30:24 -0700 |
commit | 3a81ce3cdaf9eaaad5c38cc2c56051785b84bd09 (patch) | |
tree | c3624ffed50c09e1d56d8ad976cc1f7dbd372039 | |
parent | 2dce9ca4c11ffeb43aaafe7551d3fa098fad75c4 (diff) |
added ifconfig-push and iroute options to openvpn::client
-rw-r--r-- | manifests/client.pp | 8 | ||||
-rw-r--r-- | spec/defines/openvpn_client_spec.rb | 5 | ||||
-rw-r--r-- | templates/client.erb | 8 |
3 files changed, 21 insertions, 0 deletions
diff --git a/manifests/client.pp b/manifests/client.pp index 581eece..bfa316f 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -20,6 +20,12 @@ # Default: tun # Options: tun (routed connections), tap (bridged connections) # +# [*ifconfig_push*] +# String. Interface IP to be pushed to the client +# +# [*iroute*] +# String or Array. List of iroutes to be announced to the server +# # [*mute*] # Integer. Set log mute level # Default: 20 @@ -88,6 +94,8 @@ define openvpn::client( $server, $compression = 'comp-lzo', $dev = 'tun', + $ifconfig_push = '', + $iroute = '', $mute = '20', $mute_replay_warnings = true, $nobind = true, diff --git a/spec/defines/openvpn_client_spec.rb b/spec/defines/openvpn_client_spec.rb index a4b580e..438b3ca 100644 --- a/spec/defines/openvpn_client_spec.rb +++ b/spec/defines/openvpn_client_spec.rb @@ -59,6 +59,8 @@ describe 'openvpn::client', :type => :define do 'server' => 'test_server', 'compression' => 'comp-something', 'dev' => 'tap', + 'ifconfig_push' => '10.10.9.1 255.255.255.0', + 'iroute' => [ '10.10.10.0 255.255.255.0', '10.10.11.0 255.255.255.0' ], 'mute' => 10, 'mute_replay_warnings' => false, 'nobind' => false, @@ -83,6 +85,9 @@ describe 'openvpn::client', :type => :define do it { should contain_file('/etc/openvpn/test_server/download-configs/test_client/test_client.conf').with_content(/^resolv-retry\s+2m$/)} it { should contain_file('/etc/openvpn/test_server/download-configs/test_client/test_client.conf').with_content(/^verb\s+1$/)} it { should contain_file('/etc/openvpn/test_server/download-configs/test_client/test_client.conf').with_content(/^mute\s+10$/)} + it { should contain_file('/etc/openvpn/test_server/download-configs/test_client/test_client.conf').with_content(/^iroute\s+10\.10\.10\.0\s+255\.255\.255\.0$/)} + it { should contain_file('/etc/openvpn/test_server/download-configs/test_client/test_client.conf').with_content(/^iroute\s+10\.10\.11\.0\s+255\.255\.255\.0$/)} + it { should contain_file('/etc/openvpn/test_server/download-configs/test_client/test_client.conf').with_content(/^ifconfig-push\s+10\.10\.9\.1\s+255\.255\.255\.0$/)} end end diff --git a/templates/client.erb b/templates/client.erb index 021ed61..d8b9213 100644 --- a/templates/client.erb +++ b/templates/client.erb @@ -24,3 +24,11 @@ mute-replay-warnings ns-cert-type server verb <%= scope.lookupvar('verb') %> mute <%= scope.lookupvar('mute') %> +<% if scope.lookupvar('iroute') != '' -%> +<% scope.lookupvar('iroute').to_a.each do |route| -%> +iroute <%= route %> +<% end -%> +<% end -%> +<% if scope.lookupvar('ifconfig_push') != '' -%> +ifconfig-push <%= scope.lookupvar('ifconfig_push') %> +<% end -%>
\ No newline at end of file |